﻿using Newtonsoft.Json;

namespace Dyao.Book.Contract
{
    public class BookSourceWarehouseDto
    {
        /// <summary>
        /// 编号
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 书源名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 请求头
        /// </summary>
        public string Header { get; set; }

        /// <summary>
        /// 书源地址
        /// </summary>
        public string Url { get; set; }

        /// <summary>
        /// 搜索地址
        /// https://www.xbiqu6.com/search?searchkey={0}
        /// </summary>
        public string SearchUrl { get; set; }

        /// <summary>
        /// 爬虫规则
        /// </summary>
        public string SpiderRule { get; set; }

        /// <summary>
        /// Key
        /// </summary>
        public string SourceKey { get; set; }
    }

    /// <summary>
    /// 请求头配置
    /// </summary>
    public class BookSourceWarehouseHeaderDto
    {
        /// <summary>
        /// 用户代理
        /// </summary>
        [JsonProperty("User-Agent")]
        public string UserAgent { get; set; }

        /// <summary>
        /// Cookies
        /// </summary>
        public string Cookies { get; set; }
    }

    /// <summary>
    /// 爬虫规则
    /// </summary>
    public class BookSourceWarehouseSpiderRuleDto
    {
        /// <summary>
        /// 书籍爬虫规则
        /// </summary>
        public BookSourceWarehouseBookSpiderRuleDto BookSpiderRule { get; set; }

        /// <summary>
        /// 章节目录爬虫规则
        /// </summary>
        public BookSourceWarehouseBookChapterSpiderRuleDto BookChapterSpiderRule { get; set; }

        public BookSourceWarehouseBookContentSpiderRuleDto BookContentSpiderRule { get; set; }

        /// <summary>
        /// 跳过首行
        /// </summary>
        public bool SkipFirstLine { get; set; }
    }

    /// <summary>
    /// 书籍爬虫规则
    /// </summary>
    public class BookSourceWarehouseBookSpiderRuleDto
    {
        /// <summary>
        /// 搜索出来的书籍列表
        /// </summary>
        public string BookList { get; set; }

        /// <summary>
        /// 搜索出来的书籍明细
        /// </summary>
        public string BookItem { get; set; }

        /// <summary>
        /// 书名
        /// </summary>
        public string BookName { get; set; }

        /// <summary>
        /// 书籍Url
        /// </summary>
        public string BookUrl { get; set; }

        /// <summary>
        /// 作者
        /// </summary>
        public string Author { get; set; }
    }

    /// <summary>
    /// 书源仓库目录爬取规则
    /// </summary>
    public class BookSourceWarehouseBookChapterSpiderRuleDto
    {
        /// <summary>
        /// 搜索出来的书籍列表
        /// </summary>
        public string ChapterList { get; set; }

        /// <summary>
        /// 搜索出来的书籍明细
        /// </summary>
        public string ChapterItem { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string ChapterName { get; set; }

        /// <summary>
        /// 章节Url
        /// </summary>
        public string ChapterUrl { get; set; }

        /// <summary>
        /// 分页
        /// </summary>
        public string Pager { get; set; }
    }

    /// <summary>
    /// 书源仓库内容爬虫规则
    /// </summary>
    public class BookSourceWarehouseBookContentSpiderRuleDto
    {
        /// <summary>
        /// 内容列表
        /// </summary>
        public string ContentList { get; set; }

        /// <summary>
        /// 内容明细
        /// </summary>
        public string ContentItem { get; set; }

        /// <summary>
        /// 行标签
        /// </summary>
        public string LineTag { get; set; }
    }
}
